package com.an.java.javaall.proxy;

import java.lang.reflect.Proxy;
import java.util.Arrays;

public class Go {
    public static void main(String[] args) {
        Object newProxyInstance = Proxy.newProxyInstance(SendSmsServiceImpl.class.getClassLoader(), new Class[]{SendSmsService.class}, new LogSendSms(new SendSmsServiceImpl()));
        System.out.println(newProxyInstance.getClass().getName());
        Arrays.stream(newProxyInstance.getClass().getClass().getInterfaces()).forEach(it -> {System.out.println(it.getName());});
        System.out.println(((SendSmsService) newProxyInstance).sendMsg("ddddddddddddddddd"));
    }
}
